package homework2;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class HashMapDemo {

	public static void main(String[] args) {
		HashMap<String, String> ranks = new HashMap<String, String>();
		ranks.put("1", "第一名");
		ranks.put("2", "第三名");
		ranks.put("3", "第三名");

		System.out.println("全部的key值是：");
		Set<String> keys = ranks.keySet();
		Iterator<String> it = keys.iterator();
		while (it.hasNext()) {
			String key = it.next();
			System.out.println(key);
		}

		System.out.println("全部的value值是：");
		Collection<String> values = ranks.values();
		it = keys.iterator();
		for (String value : values) {
			System.out.println(value);
		}

	}

}
